package com.yiyahui.project.erp.service.impl;

import java.util.List;
import com.yiyahui.common.utils.DateUtils;
import com.yiyahui.project.erp.domain.requestVo.SearchRequest;
import com.yiyahui.project.erp.domain.requestVo.YiYaMarketRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiyahui.project.erp.mapper.YiyaMarketReservationMapper;
import com.yiyahui.project.erp.domain.YiyaMarketReservation;
import com.yiyahui.project.erp.service.IYiyaMarketReservationService;

/**
 * 市场建档Service业务层处理
 * 
 * @author yiyahui
 * @date 2020-05-03
 */
@Service
public class YiyaMarketReservationServiceImpl implements IYiyaMarketReservationService 
{
    @Autowired
    private YiyaMarketReservationMapper yiyaMarketReservationMapper;

    /**
     * 查询市场建档
     * 
     * @param id 市场建档ID
     * @return 市场建档
     */
    @Override
    public YiyaMarketReservation selectYiyaMarketReservationById(Long id)
    {
        return yiyaMarketReservationMapper.selectYiyaMarketReservationById(id);
    }

    /**
     * 查询市场建档列表
     * 
     * @param yiYaMarketRequest 市场建档
     * @return 市场建档
     */
    @Override
    public List<YiyaMarketReservation> selectYiyaMarketReservationList(YiYaMarketRequest yiYaMarketRequest)
    {
        return yiyaMarketReservationMapper.selectYiyaMarketReservationList(yiYaMarketRequest);
    }

    /**
     * 新增市场建档
     * 
     * @param yiyaMarketReservation 市场建档
     * @return 结果
     */
    @Override
    public int insertYiyaMarketReservation(YiyaMarketReservation yiyaMarketReservation)
    {
        yiyaMarketReservation.setCreateTime(DateUtils.getNowDate());
        return yiyaMarketReservationMapper.insertYiyaMarketReservation(yiyaMarketReservation);
    }

    /**
     * 修改市场建档
     * 
     * @param yiyaMarketReservation 市场建档
     * @return 结果
     */
    @Override
    public int updateYiyaMarketReservation(YiyaMarketReservation yiyaMarketReservation)
    {
        yiyaMarketReservation.setUpdateTime(DateUtils.getNowDate());
        return yiyaMarketReservationMapper.updateYiyaMarketReservation(yiyaMarketReservation);
    }

    /**
     * 批量删除市场建档
     * 
     * @param ids 需要删除的市场建档ID
     * @return 结果
     */
    @Override
    public int deleteYiyaMarketReservationByIds(Long[] ids)
    {
        return yiyaMarketReservationMapper.deleteYiyaMarketReservationByIds(ids);
    }

    /**
     * 删除市场建档信息
     * 
     * @param id 市场建档ID
     * @return 结果
     */
    @Override
    public int deleteYiyaMarketReservationById(Long id)
    {
        return yiyaMarketReservationMapper.deleteYiyaMarketReservationById(id);
    }

    @Override
    public List<YiyaMarketReservation> selectByIds(List<Long> ids) {
        return yiyaMarketReservationMapper.selectByIds(ids);
    }

    @Override
    public List<YiyaMarketReservation> selectByNameOrPhone(SearchRequest searchRequest) {
        return yiyaMarketReservationMapper.selectByNameOrPhone(searchRequest.getKeyword());
    }


    /**
     * 根据ids查询市场建档list
     */
    @Override
    public String getPhoneByIds(String ids){
        return yiyaMarketReservationMapper.getPhoneByIds(ids);
    }
}
